﻿Imports System.ComponentModel
Imports System.Drawing
Public Class CLDS_Preferences
    ' Preferences added here must also implement a property further down, tagged with PropertyGrid attributes,
    ' and must be replicated in the CLDS_Preferences_Serial class (private class members, SavePreferences and LoadPreferences).
    ' Preferences in the section below must have a default value assigned.
    ' If adding layer and/or colour, also add a line to CLDS_ColourLayerByPrefs so that layer is updated when preferences are saved.
#Region "Private declarations"
    Private v_file As String = ""                               ' Preferences XML file name
    Private v_b_orgn As String = "CMPIC_ORIGIN"                 ' Origin block name
    Private v_b_dvce As String = "CMPIC_DEVICE"                 ' Device block name
    Private v_t_dvce As String = "DEVICE"                       ' Device block ID tag name
    Private v_b_node As String = "CMPIC_NODE"                   ' Node block name
    Private v_b_nodm As String = "-"                            ' Major node block name
    Private v_t_node As String = "NODE"                         ' Node block ID tag name
    Private v_t_type As String = "TYPE"                         ' Node block type tag name
    Private v_t_area As String = "AREA"                         ' Node block area tag name
    Private v_t_seg As String = "SEGREGATION"                   ' Node block segregation tag name
    Private v_t_comm As String = "FULLID"                       ' Node block comment tag name
    Private v_g_clds As String = "CMPIC Layer Group"            ' Layer group name
    Private v_l_dvce As String = "CLDS_DEVICE"                  ' Device layer
    Private v_l_node As String = "CLDS_NODE"                    ' Node layer
    Private v_l_nodm As String = "-"                            ' Major node layer
    Private v_l_sgmt As String = "CLDS_SGMT"                    ' Segment layer
    Private v_l_used As String = "CLDS_ROUTED"                  ' Segment with routed cables layer
    Private v_l_appd As String = "CLDS_APPROVED"                ' Segment with approved cables layer
    Private v_l_hide As String = "CLDS_HIDE"                    ' Hidden layer
    Private v_l_jump As String = "CLDS_JUMP"                    ' Jump segment layer
    Private v_l_warn As String = "CLDS_WARN"                    ' Warning segment layer
    Private v_l_eror As String = "CLDS_ERROR"                   ' Error segment layer
    Private v_l_crte As String = "CLDS_CROUTE"                  ' Routed cable segment layer
    Private v_l_arte As String = "CLDS_AROUTE"                  ' Autorouted cable segment layer
    Private v_l_isrt As String = "CLDS_ADDED"                   ' Inserted segment/node layer
    Private v_l_updt As String = "CLDS_UPDATED"                 ' Updated segment/node layer
    Private v_l_dele As String = "CLDS_DELETED"                 ' Deleted segment/node layer
    Private v_l_offr As String = "CLDS_OFFROUTE"                ' Off-route length layer
    Private v_l_hlit As String = "CLDS_HIGHLIGHT"               ' Highlighted segment/node layer
    Private v_l_brek As String = "CLDS_BREAK"                   ' Break segment layer
    Private v_x_prec As Double = 20                             ' Maximum line-end/node distance
    Private v_d_node As String = "CLDS_NODE_DICT"               ' Node dictionary name
    Private v_d_xrec As String = "CLDS_CMPIC"                   ' Segment XRecord name
    Private v_d_brek As String = "CLDS_BREAK"                   ' Break segment XRecord name
    Private v_x_fact As Double = 1000.0                         ' Length/coordinate scale factor
    Private v_c_dvce As Color = Color.FromArgb(255, 255, 0)     ' Device layer colour
    Private v_c_node As Color = Color.FromArgb(0, 255, 255)     ' Node layer colour
    Private v_c_nodm As Color = Color.FromArgb(0, 0, 0)         ' Major node layer colour
    Private v_c_sgmt As Color = Color.FromArgb(102, 0, 204)     ' Segment layer colour
    Private v_c_used As Color = Color.FromArgb(249, 172, 57)    ' Used segment layer colour
    Private v_c_appd As Color = Color.FromArgb(249, 79, 57)     ' Approved segment layer colour
    Private v_c_hide As Color = Color.FromArgb(255, 255, 255)   ' Hidden layer colour
    Private v_c_jump As Color = Color.FromArgb(212, 212, 212)   ' Jump segment layer colour
    Private v_c_warn As Color = Color.FromArgb(251, 185, 4)     ' Warning segment layer colour
    Private v_c_eror As Color = Color.FromArgb(255, 0, 0)       ' Error segment layer colour
    Private v_c_crte As Color = Color.FromArgb(255, 0, 255)     ' Routed cable segment colour
    Private v_c_arte As Color = Color.FromArgb(255, 255, 0)     ' Autorouted cable segment colour
    Private v_c_isrt As Color = Color.FromArgb(255, 255, 255)   ' Inserted segment/node colour
    Private v_c_updt As Color = Color.FromArgb(200, 255, 200)   ' Updated segment/node colour
    Private v_c_dele As Color = Color.FromArgb(240, 240, 240)   ' Deleted segment/node colour
    Private v_c_offr As Color = Color.FromArgb(155, 155, 155)   ' Off-route length colour
    Private v_c_brek As Color = Color.FromArgb(250, 180, 20)    ' Break segment colour
    Private v_h_fdev As Color = Color.FromArgb(200, 0, 0)       ' From device highlight colour
    Private v_h_tdev As Color = Color.FromArgb(0, 200, 0)       ' To device highlight colour
    Private v_h_rnod As Color = Color.FromArgb(0, 150, 0)       ' Required node/segment highlight colour
    Private v_h_pnod As Color = Color.FromArgb(150, 0, 0)       ' Prohibited node/segment highlight colour
    Private v_n_jump As String = "_JUMP"                        ' Name of CMPIC jump segment type
    Private v_n_offr As String = "OFFROUTE"                     ' Name of off-route pseudo-segment type
    Private v_f_dvce As Integer = 50                            ' Device block scale factor
    Private v_a_dvce As Integer = 0                             ' Device block rotation (degrees)
    Private v_f_node As Integer = 50                            ' Node block scale factor
    Private v_f_nodm As Integer = -1                            ' Major node block scale factor
    Private v_a_node As Integer = 0                             ' Node block rotation (degrees)
    Private v_a_nodm As Integer = 0                             ' Major node block rotation (degrees)
    Private v_r_node As String = "{AREA}-{NNNN}"                ' Node ID format rule
    Private v_r_pseg As String = ""                             ' Point-segment ID format rule (NULL implies same as Node ID)
    Private v_x_psln As Double = 0.01                           ' Point-segment length
    Private v_x_pfil As Boolean = True                          ' Include PARTFILE in segment API calls
    Private v_x_vstr As String = ""                             ' CMPIC version string
    Private v_x_vnum As Integer = 0                             ' CMPIC version number
    Private v_x_vist As String = ""                             ' Interface version string
    Private v_x_v9st As String = ""                             ' V9 rule-set version string
    Private v_x_timo As Integer = 120                           ' CMPIC API timeout (seconds)
    Private v_x_rfsh As Integer = 250                           ' Job refresh interval (milliseconds)
    Private v_x_dlpl As Boolean = False                         ' Deleted followed polylines after node addition
    Private v_x_lint As Integer = 0                             ' Segment line thickness
    Private v_r_xmlf As String = "%TEMP%\{dwg}_{date}.xml"      ' XML output directory\file name
    Private v_r_xmld As String = "yyyyMMdd_HHmmss"              ' XML output file date suffix format
    Private v_c_seqn As New CLDS_Colour_Collection              ' Colour collection for multiple highlights
    Private v_x_maxe As Integer = 100                           ' Maximum API errors before giving up
#End Region
#Region "Device preferences"
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block name"), _
       DescriptionAttribute("Name of block representing CMPIC device")> _
    Public Property b_dvce() As String
        Get
            Return v_b_dvce
        End Get
        Set(ByVal value As String)
            v_b_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block scale factor"), _
       DescriptionAttribute("Scale factor to apply during block insertion")> _
    Public Property f_dvce() As String
        Get
            Return v_f_dvce
        End Get
        Set(ByVal value As String)
            v_f_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block rotation"), _
       DescriptionAttribute("Rotation (degrees) to apply during block insertion")> _
    Public Property a_dvce() As String
        Get
            Return v_a_dvce
        End Get
        Set(ByVal value As String)
            v_a_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("ID tag name"), _
       DescriptionAttribute("Name of ID attribute in device block")> _
    Public Property t_dvce() As String
        Get
            Return v_t_dvce
        End Get
        Set(ByVal value As String)
            v_t_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Layer name"), _
       DescriptionAttribute("Name of layer for devices")> _
    Public Property l_dvce() As String
        Get
            Return v_l_dvce
        End Get
        Set(ByVal value As String)
            v_l_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Layer colour"), _
       DescriptionAttribute("Colour of device layer")> _
    Public Property c_dvce() As Color
        Get
            Return v_c_dvce
        End Get
        Set(ByVal value As Color)
            v_c_dvce = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("To-device colour"), _
       DescriptionAttribute("Highlight colour for cable to-device")> _
    Public Property h_tdev() As Color
        Get
            Return v_h_tdev
        End Get
        Set(ByVal value As Color)
            v_h_tdev = value
        End Set
    End Property
    <CategoryAttribute("Device"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("From-device colour"), _
       DescriptionAttribute("Highlight colour for cable from-device")> _
    Public Property h_fdev() As Color
        Get
            Return v_h_fdev
        End Get
        Set(ByVal value As Color)
            v_h_fdev = value
        End Set
    End Property
#End Region
#Region "Node preferences"
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block name"), _
       DescriptionAttribute("Name of block representing CMPIC node")> _
    Public Property b_node() As String
        Get
            Return v_b_node
        End Get
        Set(ByVal value As String)
            v_b_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Major block name"), _
       DescriptionAttribute("Name of block representing CMPIC major node")> _
    Public Property b_nodm() As String
        Get
            Return v_b_nodm
        End Get
        Set(ByVal value As String)
            v_b_nodm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block scale factor"), _
       DescriptionAttribute("Scale factor to apply during block insertion")> _
    Public Property f_node() As String
        Get
            Return v_f_node
        End Get
        Set(ByVal value As String)
            v_f_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Major block scale factor"), _
       DescriptionAttribute("Scale factor to apply during major node block insertion")> _
    Public Property f_nodm() As String
        Get
            If v_f_nodm = 0 Then
                Return v_f_node
            Else
                Return v_f_nodm
            End If
        End Get
        Set(ByVal value As String)
            v_f_nodm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Block rotation"), _
       DescriptionAttribute("Rotation (degrees) to apply during block insertion")> _
    Public Property a_node() As String
        Get
            Return v_a_node
        End Get
        Set(ByVal value As String)
            v_a_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Major block rotation"), _
       DescriptionAttribute("Rotation (degrees) to apply during major node block insertion")> _
    Public Property a_nodm() As String
        Get
            If v_f_nodm = 0 Then
                Return v_a_node
            Else
                Return v_a_nodm
            End If
        End Get
        Set(ByVal value As String)
            v_a_nodm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("ID tag name"), _
       DescriptionAttribute("Name of ID attribute in node block")> _
    Public Property t_node() As String
        Get
            Return v_t_node
        End Get
        Set(ByVal value As String)
            v_t_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Type tag name"), _
       DescriptionAttribute("Name of point-segment type attribute in node block")> _
    Public Property t_type() As String
        Get
            Return v_t_type
        End Get
        Set(ByVal value As String)
            v_t_type = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Area tag name"), _
       DescriptionAttribute("Name of area attribute in node block")> _
    Public Property t_area() As String
        Get
            Return v_t_area
        End Get
        Set(ByVal value As String)
            v_t_area = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Segregation tag name"), _
       DescriptionAttribute("Name of segregation attribute in node block")> _
    Public Property t_seg() As String
        Get
            Return v_t_seg
        End Get
        Set(ByVal value As String)
            v_t_seg = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
   Browsable(True), _
   [ReadOnly](False), _
   BindableAttribute(False), _
   DefaultValueAttribute(""), _
   DesignOnly(False), _
   DisplayName("Comment tag name"), _
   DescriptionAttribute("Name of comment attribute in node block")> _
Public Property t_comm() As String
        Get
            Return v_t_comm
        End Get
        Set(ByVal value As String)
            v_t_comm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Layer name"), _
       DescriptionAttribute("Name of layer for nodes")> _
    Public Property l_node() As String
        Get
            Return v_l_node
        End Get
        Set(ByVal value As String)
            v_l_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Layer colour"), _
       DescriptionAttribute("Colour of node layer")> _
    Public Property c_node() As Color
        Get
            Return v_c_node
        End Get
        Set(ByVal value As Color)
            v_c_node = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Major node layer name"), _
       DescriptionAttribute("Name of layer for major nodes")> _
    Public Property l_nodm() As String
        Get
            Return v_l_nodm
        End Get
        Set(ByVal value As String)
            v_l_nodm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Major node layer colour"), _
       DescriptionAttribute("Colour of major node layer")> _
    Public Property c_nodm() As Color
        Get
            Return v_c_nodm
        End Get
        Set(ByVal value As Color)
            v_c_nodm = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Required node colour"), _
       DescriptionAttribute("Highlight colour for required nodes")> _
    Public Property h_rnod() As Color
        Get
            Return v_h_rnod
        End Get
        Set(ByVal value As Color)
            v_h_rnod = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Prohibited node colour"), _
       DescriptionAttribute("Highlight colour for prohibited nodes")> _
    Public Property h_pnod() As Color
        Get
            Return v_h_pnod
        End Get
        Set(ByVal value As Color)
            v_h_pnod = value
        End Set
    End Property
    <CategoryAttribute("Node"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("ID format rule"), _
       DescriptionAttribute("Format rule for node ID auto-generation")> _
    Public Property r_node() As String
        Get
            Return v_r_node
        End Get
        Set(ByVal value As String)
            v_r_node = value
        End Set
    End Property
#End Region
#Region "Segment preferences"
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Unused layer name"), _
       DescriptionAttribute("Name of layer for unused segments")> _
    Public Property l_sgmt() As String
        Get
            Return v_l_sgmt
        End Get
        Set(ByVal value As String)
            v_l_sgmt = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Unused layer colour"), _
       DescriptionAttribute("Colour of unused segment layer")> _
    Public Property c_sgmt() As Color
        Get
            Return v_c_sgmt
        End Get
        Set(ByVal value As Color)
            v_c_sgmt = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Used layer name"), _
       DescriptionAttribute("Name of layer for used (routed) segments")> _
    Public Property l_used() As String
        Get
            Return v_l_used
        End Get
        Set(ByVal value As String)
            v_l_used = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Used layer colour"), _
       DescriptionAttribute("Colour of used segment layer")> _
    Public Property c_used() As Color
        Get
            Return v_c_used
        End Get
        Set(ByVal value As Color)
            v_c_used = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Approved layer name"), _
       DescriptionAttribute("Name of layer for approved segments")> _
    Public Property l_appd() As String
        Get
            Return v_l_appd
        End Get
        Set(ByVal value As String)
            v_l_appd = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Approved layer colour"), _
       DescriptionAttribute("Colour of approved segment layer")> _
    Public Property c_appd() As Color
        Get
            Return v_c_appd
        End Get
        Set(ByVal value As Color)
            v_c_appd = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Jump layer name"), _
       DescriptionAttribute("Name of layer for jump segments")> _
    Public Property l_jump() As String
        Get
            Return v_l_jump
        End Get
        Set(ByVal value As String)
            v_l_jump = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Jump layer colour"), _
       DescriptionAttribute("Colour of jump segment layer")> _
    Public Property c_jump() As Color
        Get
            Return v_c_jump
        End Get
        Set(ByVal value As Color)
            v_c_jump = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Jump type code"), _
       DescriptionAttribute("Name of jump segment type")> _
    Public Property n_jump() As String
        Get
            Return v_n_jump
        End Get
        Set(ByVal value As String)
            v_n_jump = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Off-route pseudo code"), _
       DescriptionAttribute("Name of off-route pseudo-segment type")> _
    Public Property n_offr() As String
        Get
            Return v_n_offr
        End Get
        Set(ByVal value As String)
            v_n_offr = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Off-route length layer"), _
       DescriptionAttribute("Name of layer for off-route lengths")> _
    Public Property l_offr() As String
        Get
            Return v_l_offr
        End Get
        Set(ByVal value As String)
            v_l_offr = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Off-route layer colour"), _
       DescriptionAttribute("Colour of off-route length layer")> _
    Public Property c_offr() As Color
        Get
            Return v_c_offr
        End Get
        Set(ByVal value As Color)
            v_c_offr = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Break segment layer"), _
       DescriptionAttribute("Name of layer for break segments")> _
    Public Property l_brek() As String
        Get
            Return v_l_brek
        End Get
        Set(ByVal value As String)
            v_l_brek = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Break segment layer colour"), _
       DescriptionAttribute("Colour of break segment layer")> _
    Public Property c_brek() As Color
        Get
            Return v_c_brek
        End Get
        Set(ByVal value As Color)
            v_c_brek = value
        End Set
    End Property
    <CategoryAttribute("Segment"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Point-segment ID format rule"), _
       DescriptionAttribute("Format rule for point-segment ID auto-generation")> _
    Public Property r_pseg() As String
        Get
            Return v_r_pseg
        End Get
        Set(ByVal value As String)
            v_r_pseg = value
        End Set
    End Property
#End Region
#Region "Route preferences"
    <CategoryAttribute("Route"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Current route layer name"), _
       DescriptionAttribute("Name of layer for current cable routes")> _
    Public Property l_crte() As String
        Get
            Return v_l_crte
        End Get
        Set(ByVal value As String)
            v_l_crte = value
        End Set
    End Property
    <CategoryAttribute("Route"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Current route layer colour"), _
       DescriptionAttribute("Colour of current route layer")> _
    Public Property c_crte() As Color
        Get
            Return v_c_crte
        End Get
        Set(ByVal value As Color)
            v_c_crte = value
        End Set
    End Property
    <CategoryAttribute("Route"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Autoroute layer name"), _
       DescriptionAttribute("Name of layer for potential routes from autorouter")> _
    Public Property l_arte() As String
        Get
            Return v_l_arte
        End Get
        Set(ByVal value As String)
            v_l_arte = value
        End Set
    End Property
    <CategoryAttribute("Route"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Autoroute layer colour"), _
       DescriptionAttribute("Colour of autoroute layer")> _
    Public Property c_arte() As Color
        Get
            Return v_c_arte
        End Get
        Set(ByVal value As Color)
            v_c_arte = value
        End Set
    End Property
    <CategoryAttribute("Route"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Highlight colours"), _
       DescriptionAttribute("Colours to use when highlighting multiple routes")> _
    Public Property c_seqn() As CLDS_Colour_Collection
        Get
            Return v_c_seqn
        End Get
        Set(ByVal value As CLDS_Colour_Collection)
            v_c_seqn = value
        End Set
    End Property
#End Region
#Region "General preferences"
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Preferences file name"), _
       DescriptionAttribute("Name of XML file specifying these preferences")> _
    Public Property g_file() As String
        Get
            Return v_file
        End Get
        Set(ByVal value As String)
            v_file = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("CMPIC layer group name"), _
       DescriptionAttribute("Name of layer filter group for all CMPIC layers")> _
    Public Property g_clds() As String
        Get
            Return v_g_clds
        End Get
        Set(ByVal value As String)
            v_g_clds = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Hidden entity layer name"), _
       DescriptionAttribute("Name of layer for hidden nodes and segments")> _
    Public Property l_hide() As String
        Get
            Return v_l_hide
        End Get
        Set(ByVal value As String)
            v_l_hide = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("CMPIC origin block name"), _
       DescriptionAttribute("Name of block specifying origin on 2D plan view")> _
    Public Property b_orgn() As String
        Get
            Return v_b_orgn
        End Get
        Set(ByVal value As String)
            v_b_orgn = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Hidden entity layer colour"), _
       DescriptionAttribute("Colour of hidden layer")> _
    Public Property c_hide() As Color
        Get
            Return v_c_hide
        End Get
        Set(ByVal value As Color)
            v_c_hide = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Warning entity layer name"), _
       DescriptionAttribute("Name of layer for nodes and segments with warnings")> _
    Public Property l_warn() As String
        Get
            Return v_l_warn
        End Get
        Set(ByVal value As String)
            v_l_warn = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Warning entity layer colour"), _
       DescriptionAttribute("Colour of warning layer")> _
    Public Property c_warn() As Color
        Get
            Return v_c_warn
        End Get
        Set(ByVal value As Color)
            v_c_warn = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Error entity layer name"), _
       DescriptionAttribute("Name of layer for nodes and segments with errors")> _
    Public Property l_eror() As String
        Get
            Return v_l_eror
        End Get
        Set(ByVal value As String)
            v_l_eror = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Error entity layer colour"), _
       DescriptionAttribute("Colour of error layer")> _
    Public Property c_eror() As Color
        Get
            Return v_c_eror
        End Get
        Set(ByVal value As Color)
            v_c_eror = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Inserted entity layer name"), _
       DescriptionAttribute("Name of layer for nodes and segments pending insertion")> _
    Public Property l_isrt() As String
        Get
            Return v_l_isrt
        End Get
        Set(ByVal value As String)
            v_l_isrt = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Inserted entity layer colour"), _
       DescriptionAttribute("Colour of inserted entity layer")> _
    Public Property c_isrt() As Color
        Get
            Return v_c_isrt
        End Get
        Set(ByVal value As Color)
            v_c_isrt = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Updated entity layer name"), _
       DescriptionAttribute("Name of layer for nodes and segments pending update")> _
    Public Property l_updt() As String
        Get
            Return v_l_updt
        End Get
        Set(ByVal value As String)
            v_l_updt = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Updated entity layer colour"), _
       DescriptionAttribute("Colour of updated entity layer")> _
    Public Property c_updt() As Color
        Get
            Return v_c_updt
        End Get
        Set(ByVal value As Color)
            v_c_updt = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Deleted entity layer name"), _
       DescriptionAttribute("Name of layer for nodes and segments pending deletion")> _
    Public Property l_dele() As String
        Get
            Return v_l_dele
        End Get
        Set(ByVal value As String)
            v_l_dele = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Deleted entity layer colour"), _
       DescriptionAttribute("Colour of deleted entity layer")> _
    Public Property c_dele() As Color
        Get
            Return v_c_dele
        End Get
        Set(ByVal value As Color)
            v_c_dele = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Highlighted entity layer name"), _
       DescriptionAttribute("Name of layer for highlighted devices, nodes and segments")> _
    Public Property l_hlit() As String
        Get
            Return v_l_hlit
        End Get
        Set(ByVal value As String)
            v_l_hlit = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Node proximity precision"), _
       DescriptionAttribute("Maximum allowable radius around node point for segment joins")> _
    Public Property x_prec() As Double
        Get
            Return v_x_prec
        End Get
        Set(ByVal value As Double)
            v_x_prec = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Segment line thickness"), _
       DescriptionAttribute("Segment line thickness")> _
    Public Property x_lint() As Integer
        Get
            Return v_x_lint
        End Get
        Set(ByVal value As Integer)
            v_x_lint = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Point-segment length [m]"), _
       DescriptionAttribute("Length in meters for point-segments")> _
    Public Property x_psln() As Double
        Get
            Return v_x_psln
        End Get
        Set(ByVal value As Double)
            v_x_psln = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Node dictionary name"), _
       DescriptionAttribute("Name of internal dictionary used to catalog nodes")> _
    Public Property d_node() As String
        Get
            Return v_d_node
        End Get
        Set(ByVal value As String)
            v_d_node = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("XRecord name"), _
       DescriptionAttribute("Name of internal XRecords used to tag segment lines")> _
    Public Property d_xrec() As String
        Get
            Return v_d_xrec
        End Get
        Set(ByVal value As String)
            v_d_xrec = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("XRecord name"), _
       DescriptionAttribute("Name of internal XRecords used to tag segment breaks")> _
    Public Property d_brek() As String
        Get
            Return v_d_brek
        End Get
        Set(ByVal value As String)
            v_d_brek = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Scale factor"), _
       DescriptionAttribute("Scale factor (f) for coordinates and lengths [Autocad = f * CMPIC]")> _
    Public Property x_fact() As Double
        Get
            Return v_x_fact
        End Get
        Set(ByVal value As Double)
            v_x_fact = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Include PARTFILE"), _
       DescriptionAttribute("Include PARTFILE association when creating CMPIC segments")> _
    Public Property x_pfil() As Boolean
        Get
            Return v_x_pfil
        End Get
        Set(ByVal value As Boolean)
            v_x_pfil = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("CMPIC version string"), _
       DescriptionAttribute("CMPIC version string")> _
    Public Property x_vstr() As String
        Get
            Return v_x_vstr
        End Get
        Set(ByVal value As String)
            v_x_vstr = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("CMPIC version number"), _
       DescriptionAttribute("CMPIC version number")> _
    Public Property x_vnum() As Integer
        Get
            Return v_x_vnum
        End Get
        Set(ByVal value As Integer)
            v_x_vnum = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Interface version"), _
       DescriptionAttribute("Interface version string")> _
    Public Property x_vist() As String
        Get
            Return v_x_vist
        End Get
        Set(ByVal value As String)
            v_x_vist = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](True), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("V9 rule-set version"), _
       DescriptionAttribute("V9 rule-set version string")> _
    Public Property x_v9st() As String
        Get
            Return v_x_v9st
        End Get
        Set(ByVal value As String)
            v_x_v9st = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("API job timeout"), _
       DescriptionAttribute("API job timeout (seconds)")> _
    Public Property x_timo() As Integer
        Get
            Return v_x_timo
        End Get
        Set(ByVal value As Integer)
            v_x_timo = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("API max errors"), _
       DescriptionAttribute("Maximum API errors allowed" & Chr(10) & "(zero none, -1 unlimited)")> _
    Public Property x_maxe() As Integer
        Get
            Return v_x_maxe
        End Get
        Set(ByVal value As Integer)
            v_x_maxe = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Job refresh interval"), _
       DescriptionAttribute("Interval between refreshes for jobs/autoroutes (milliseconds)")> _
    Public Property x_rfsh() As Integer
        Get
            Return v_x_rfsh
        End Get
        Set(ByVal value As Integer)
            v_x_rfsh = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("Remove followed polyline"), _
       DescriptionAttribute("Remove followed polyline after adding nodes")> _
    Public Property x_dlpl() As Boolean
        Get
            Return v_x_dlpl
        End Get
        Set(ByVal value As Boolean)
            v_x_dlpl = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("XML output name"), _
       DescriptionAttribute("XML output directory/file name")> _
    Public Property r_xmlf() As String
        Get
            Return v_r_xmlf
        End Get
        Set(ByVal value As String)
            v_r_xmlf = value
        End Set
    End Property
    <CategoryAttribute("General"), _
       Browsable(True), _
       [ReadOnly](False), _
       BindableAttribute(False), _
       DefaultValueAttribute(""), _
       DesignOnly(False), _
       DisplayName("XML output date"), _
       DescriptionAttribute("XML output file date format")> _
    Public Property r_xmld() As String
        Get
            Return v_r_xmld
        End Get
        Set(ByVal value As String)
            v_r_xmld = value
        End Set
    End Property
#End Region
#Region "Methods"
    Public Sub SavePreferences()
        Dim s As New CLDS_Preferences_Serial
        s.SavePreferences(Me)
    End Sub
    Public Sub LoadPreferences()
        Dim s As New CLDS_Preferences_Serial
        s.LoadPreferences(Me)
    End Sub
#End Region
End Class
